/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('paielasticdatasetaccelerator', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model EndpointStatus {
  code?: string(name='Code', example='200'),
  detail?: EndpointStatusDetail(name='Detail'),
  message?: string(name='Message', example='Init Succeed'),
  phase?: string(name='Phase', example='Ready'),
}

model EndpointStatusDetail {
  ipPortMapping?: map[string]IpPort(name='IpPortMapping', example='{ 	"slot-j6co2fcd": {   	"Ip": "10.0.0.2", 		"Port": 7001 	}, 	"slot-asdgys4d": {   	"Ip": "10.0.0.3", 		"Port": 7002 	} }'),
}

model InstanceLifeCycle {
  config?: string(name='Config'),
  type?: string(name='Type', example='Running'),
}

model InstanceStatus {
  code?: string(name='Code', example='200'),
  message?: string(name='Message', example='Init Succeed'),
  phase?: string(name='Phase', example='Running'),
  slotNum?: int32(name='SlotNum', example='10'),
  usedCapacity?: string(name='UsedCapacity', example='20.0G'),
}

model IpPort {
  ip?: string(name='Ip', example='10.0.0.5'),
  port?: string(name='Port', example='3306'),
}

model Metric {
  timestamp?: string(name='Timestamp', example='1655897743'),
  value?: double(name='Value', example='98.35'),
}

model SlotLifeCycle {
  config?: string(name='Config', example='{}'),
  type?: string(name='Type', example='Running'),
}

model SlotStatus {
  code?: string(name='Code', example='200'),
  detail?: SlotStatusDetail(name='Detail'),
  message?: string(name='Message', example='Init Succeed'),
  phase?: string(name='Phase', example='Running'),
}

model SlotStatusDetail {
  loadedFileNum?: long(name='LoadedFileNum', example='1000000'),
  loadedFileSize?: string(name='LoadedFileSize', example='200G'),
  loadingTimeCost?: long(name='LoadingTimeCost', example='1800000'),
}

model BindEndpointResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model BindEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: BindEndpointResponseBody(name='body'),
}

async function bindEndpointWithOptions(EndpointId: string, SlotId: string, headers: map[string]string, runtime: Util.RuntimeOptions): BindEndpointResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'BindEndpoint',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/endpoints/${OpenApiUtil.getEncodeParam(EndpointId)}/slots/${OpenApiUtil.getEncodeParam(SlotId)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function bindEndpoint(EndpointId: string, SlotId: string): BindEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return bindEndpointWithOptions(EndpointId, SlotId, headers, runtime);
}

model CreateEndpointRequest {
  instanceId?: string(name='InstanceId', example='inst-ivrq92qhbyrg4jctih'),
  name?: string(name='Name', example='endpoint-1'),
  type?: string(name='Type', example='VPC'),
  vpcId?: string(name='VpcId', example='vpc-j6co2fcdsl1q0gnuc3ym3'),
  vswitchId?: string(name='VswitchId', example='vsw-j6cmr00qjyrft6jo2mg7g'),
}

model CreateEndpointResponseBody = {
  endpointId?: string(name='EndpointId', example='end-5zk866779me51jgu3w'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model CreateEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateEndpointResponseBody(name='body'),
}

async function createEndpointWithOptions(request: CreateEndpointRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateEndpointResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  if (!Util.isUnset(request.vpcId)) {
    body['VpcId'] = request.vpcId;
  }
  if (!Util.isUnset(request.vswitchId)) {
    body['VswitchId'] = request.vswitchId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateEndpoint',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/endpoints`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createEndpoint(request: CreateEndpointRequest): CreateEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createEndpointWithOptions(request, headers, runtime);
}

model CreateInstanceRequest {
  capacity?: string(name='Capacity', example='30.0G'),
  description?: string(name='Description', example='xgboost数据集加速实例'),
  maxEndpoint?: string(name='MaxEndpoint', example='20'),
  maxSlot?: string(name='MaxSlot', example='20'),
  name?: string(name='Name', example='acc_instance_1'),
  paymentType?: string(name='PaymentType', example='PayAsYouGo'),
  providerType?: string(name='ProviderType', example='Ecs'),
  storageType?: string(name='StorageType', example='OSS'),
  tags?: [ 
    {
      key?: string(name='Key', example='dataset_version'),
      value?: string(name='Value', example='v0.1.0'),
    }
  ](name='Tags'),
  type?: string(name='Type', example='basic'),
}

model CreateInstanceResponseBody = {
  instanceId?: string(name='InstanceId', example='inst-my1tk3jggooi5uwks5'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model CreateInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateInstanceResponseBody(name='body'),
}

async function createInstanceWithOptions(request: CreateInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.capacity)) {
    body['Capacity'] = request.capacity;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.maxEndpoint)) {
    body['MaxEndpoint'] = request.maxEndpoint;
  }
  if (!Util.isUnset(request.maxSlot)) {
    body['MaxSlot'] = request.maxSlot;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.paymentType)) {
    body['PaymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.providerType)) {
    body['ProviderType'] = request.providerType;
  }
  if (!Util.isUnset(request.storageType)) {
    body['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/instances`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceWithOptions(request, headers, runtime);
}

model CreateSlotRequest {
  capacity?: string(name='Capacity', example='30.0G'),
  description?: string(name='Description', example='xgboost数据集加速槽'),
  endpointIds?: string(name='EndpointIds', example='end-my1tk3jggooi5uwks5,end-n69468yvjz8d12as7d,end-tga4omjrepklkg1onn'),
  endpoints?: [ 
    {
      name?: string(name='Name', example='endpoint-1'),
      type?: string(name='Type', example='VPC'),
      vpcId?: string(name='VpcId', example='vpc-j6co2fcdsl1q0gnuc3ym3'),
      vswitchId?: string(name='VswitchId', example='vsw-j6cmr00qjyrft6jo2mg7g'),
    }
  ](name='Endpoints'),
  instanceId?: string(name='InstanceId', example='inst-my1tk3jggooi5uwks5'),
  lifeCycle?: SlotLifeCycle(name='LifeCycle'),
  name?: string(name='Name', example='slot_1'),
  storageType?: string(name='StorageType', example='OSS'),
  storageUri?: string(name='StorageUri', example='oss://pai-vision-data-hz2.oss-cn-hangzhou-internal.aliyuncs.com/data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
  tags?: [ 
    {
      key?: string(name='Key', example='dataset_version'),
      value?: string(name='Value', example='v0.1.0'),
    }
  ](name='Tags'),
}

model CreateSlotResponseBody = {
  endpointIds?: string(name='EndpointIds', example='end-5zk866779me51jgu3w,end-5zk866779me51jgu3w'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  slotId?: string(name='SlotId', example='slot-5zk866779me51jgu3w'),
}

model CreateSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSlotResponseBody(name='body'),
}

async function createSlotWithOptions(request: CreateSlotRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateSlotResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.capacity)) {
    body['Capacity'] = request.capacity;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.endpointIds)) {
    body['EndpointIds'] = request.endpointIds;
  }
  if (!Util.isUnset(request.endpoints)) {
    body['Endpoints'] = request.endpoints;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.lifeCycle)) {
    body['LifeCycle'] = request.lifeCycle;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.storageType)) {
    body['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.storageUri)) {
    body['StorageUri'] = request.storageUri;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSlot',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSlot(request: CreateSlotRequest): CreateSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createSlotWithOptions(request, headers, runtime);
}

model CreateSlotsRequest {
  dryRun?: boolean(name='DryRun', example='true'),
  slots?: [ 
    {
      capacity?: string(name='Capacity', example='30.0G'),
      description?: string(name='Description', example='xgboost数据集加速槽'),
      endpointIds?: string(name='EndpointIds', example='end-my1tk3jggooi5uwks5,end-n69468yvjz8d12as7d,end-tga4omjrepklkg1onn'),
      instanceId?: string(name='InstanceId', example='inst-my1tk3jggooi5uwks5'),
      lifeCycle?: SlotLifeCycle(name='LifeCycle'),
      name?: string(name='Name', example='slot_1'),
      storageType?: string(name='StorageType', example='OSS'),
      storageUri?: string(name='StorageUri', example='oss://pai-vision-data-hz2.oss-cn-hangzhou-internal.aliyuncs.com/data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
      tags?: [ 
        {
          key?: string(name='Key', example='dataset_version'),
          value?: string(name='Value', example='v0.1.0'),
        }
      ](name='Tags'),
    }
  ](name='Slots'),
}

model CreateSlotsResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  slotIds?: string(name='SlotIds', example='slot-5zk866779me51jgu3w'),
  summary?: map[string]string(name='Summary'),
}

model CreateSlotsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSlotsResponseBody(name='body'),
}

async function createSlotsWithOptions(request: CreateSlotsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateSlotsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    body['DryRun'] = request.dryRun;
  }
  if (!Util.isUnset(request.slots)) {
    body['Slots'] = request.slots;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSlots',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/batch/slots/create`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSlots(request: CreateSlotsRequest): CreateSlotsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createSlotsWithOptions(request, headers, runtime);
}

model CreateTagRequest {
  key?: string(name='Key', example='dataset_version'),
  resourceId?: string(name='ResourceId', example='inst-my1tk3jggooi5uwks'),
  resourceType?: string(name='ResourceType', example='Instance'),
  value?: string(name='Value', example='v0.1.0'),
}

model CreateTagResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model CreateTagResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTagResponseBody(name='body'),
}

async function createTagWithOptions(request: CreateTagRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTagResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.key)) {
    body['Key'] = request.key;
  }
  if (!Util.isUnset(request.resourceId)) {
    body['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    body['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.value)) {
    body['Value'] = request.value;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTag',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/tags`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTag(request: CreateTagRequest): CreateTagResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTagWithOptions(request, headers, runtime);
}

model DeleteEndpointResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model DeleteEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteEndpointResponseBody(name='body'),
}

async function deleteEndpointWithOptions(EndpointId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteEndpointResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteEndpoint',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/endpoints/${OpenApiUtil.getEncodeParam(EndpointId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteEndpoint(EndpointId: string): DeleteEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteEndpointWithOptions(EndpointId, headers, runtime);
}

model DeleteInstanceResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model DeleteInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteInstanceResponseBody(name='body'),
}

async function deleteInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/instances/${OpenApiUtil.getEncodeParam(InstanceId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteInstance(InstanceId: string): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteInstanceWithOptions(InstanceId, headers, runtime);
}

model DeleteSlotRequest {
  force?: boolean(name='Force', example='false'),
}

model DeleteSlotResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model DeleteSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteSlotResponseBody(name='body'),
}

async function deleteSlotWithOptions(SlotId: string, request: DeleteSlotRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteSlotResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.force)) {
    query['Force'] = request.force;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSlot',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots/${OpenApiUtil.getEncodeParam(SlotId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteSlot(SlotId: string, request: DeleteSlotRequest): DeleteSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteSlotWithOptions(SlotId, request, headers, runtime);
}

model DeleteTagRequest {
  key?: string(name='Key', example='dataset_version'),
  resourceId?: string(name='ResourceId', example='inst-my1tk3jggooi5uwks'),
  resourceType?: string(name='ResourceType', example='Instance'),
}

model DeleteTagResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model DeleteTagResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTagResponseBody(name='body'),
}

async function deleteTagWithOptions(request: DeleteTagRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTagResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTag',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/tags`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTag(request: DeleteTagRequest): DeleteTagResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTagWithOptions(request, headers, runtime);
}

model DescribeComponentRequest {
  renderTemplate?: boolean(name='RenderTemplate', example='true'),
  values?: map[string]any(name='Values'),
}

model DescribeComponentShrinkRequest {
  renderTemplate?: boolean(name='RenderTemplate', example='true'),
  valuesShrink?: string(name='Values'),
}

model DescribeComponentResponseBody = {
  gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
  name?: string(name='Name', example='dataset-accelerator'),
  ownerId?: string(name='OwnerId', example='1557702098194904'),
  renderedContent?: string(name='RenderedContent', example='---\\n# Source: dataset-accelerator/templates/dataset-accelerator\\napiVersion: data.datasetacc.io/v1\\nkind: DataSetAccelerator\\nmetadata:\\n  name: dataset-accelerator\\nspec:\\n  frontEndAddr: 10.0.0.2\\n  frontEndPort: 7001\\n'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  template?: {
    type?: string(name='Type', example='OSS'),
    uri?: string(name='Uri', example='data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
  }(name='Template'),
  userId?: string(name='UserId', example='276065346797410278'),
  uuid?: string(name='Uuid', example='cmpt-5zk866779me51jgu3w'),
  version?: string(name='Version', example='v1.0.0'),
}

model DescribeComponentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeComponentResponseBody(name='body'),
}

async function describeComponentWithOptions(ComponentId: string, tmpReq: DescribeComponentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeComponentResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeComponentShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.values)) {
    request.valuesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.values, 'Values', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.renderTemplate)) {
    query['RenderTemplate'] = request.renderTemplate;
  }
  if (!Util.isUnset(request.valuesShrink)) {
    query['Values'] = request.valuesShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeComponent',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/components/${OpenApiUtil.getEncodeParam(ComponentId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeComponent(ComponentId: string, request: DescribeComponentRequest): DescribeComponentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeComponentWithOptions(ComponentId, request, headers, runtime);
}

model DescribeEndpointResponseBody = {
  gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
  name?: string(name='Name', example='endpoint-1'),
  ownerId?: string(name='OwnerId', example='1557702098194904'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  status?: EndpointStatus(name='Status'),
  type?: string(name='Type', example='VPC'),
  userId?: string(name='UserId', example='276065346797410278'),
  uuid?: string(name='Uuid', example='end-ivrq92qhbyrg4jctih'),
  vpcId?: string(name='VpcId', example='vpc-j6co2fcdsl1q0gnuc3ym3'),
  vswitchId?: string(name='VswitchId', example='vsw-j6cmr00qjyrft6jo2mg7g'),
}

model DescribeEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeEndpointResponseBody(name='body'),
}

async function describeEndpointWithOptions(EndpointId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeEndpointResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeEndpoint',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/endpoints/${OpenApiUtil.getEncodeParam(EndpointId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeEndpoint(EndpointId: string): DescribeEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeEndpointWithOptions(EndpointId, headers, runtime);
}

model DescribeInstanceResponseBody = {
  capacity?: string(name='Capacity', example='30.0G'),
  description?: string(name='Description', example='xgboost数据集加速实例'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
  ioType?: string(name='IoType', example='readonly'),
  maxEndpoint?: int32(name='MaxEndpoint', description='数据集加速实例的最大挂载点个数。'),
  maxSlot?: int32(name='MaxSlot', example='20'),
  name?: string(name='Name', example='acc_instance_1'),
  ownerId?: string(name='OwnerId', example='1557702098194904'),
  paymentType?: string(name='PaymentType', example='PayAsYouGo'),
  providerType?: string(name='ProviderType', description='数据集加速实例的资源提供者类型。', example='Ecs'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  status?: InstanceStatus(name='Status'),
  storageType?: string(name='StorageType', description='数据集加速实例的存储类型。', example='OSS'),
  tags?: [ 
    {
      key?: string(name='Key', example='dataset_version'),
      value?: string(name='Value', example='v0.1.0'),
    }
  ](name='Tags'),
  type?: string(name='Type', example='basic'),
  userId?: string(name='UserId', example='276065346797410278'),
  uuid?: string(name='Uuid', example='inst-my1tk3jggooi5uwks5'),
}

model DescribeInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeInstanceResponseBody(name='body'),
}

async function describeInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/instances/${OpenApiUtil.getEncodeParam(InstanceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeInstance(InstanceId: string): DescribeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeInstanceWithOptions(InstanceId, headers, runtime);
}

model DescribeSlotResponseBody = {
  capacity?: string(name='Capacity', example='30.0G'),
  description?: string(name='Description', example='xgboost数据集加速槽'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
  instanceId?: string(name='InstanceId', example='inst-my1tk3jggooi5uwks5'),
  ioType?: string(name='IoType', description='数据集加速槽的读写类型。', example='readonly'),
  lifeCycle?: SlotLifeCycle(name='LifeCycle'),
  name?: string(name='Name', example='slot_1'),
  ownerId?: string(name='OwnerId', example='1557702098194904'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  status?: SlotStatus(name='Status'),
  storageType?: string(name='StorageType', example='OSS'),
  storageUri?: string(name='StorageUri', example='oss://pai-vision-data-hz2.oss-cn-hangzhou-internal.aliyuncs.com/data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
  tags?: [ 
    {
      key?: string(name='Key', example='dataset_version'),
      value?: string(name='Value', example='v0.1.0'),
    }
  ](name='Tags'),
  userId?: string(name='UserId', example='276065346797410278'),
  uuid?: string(name='Uuid', example='slot-5zk866779me51jgu3w'),
}

model DescribeSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSlotResponseBody(name='body'),
}

async function describeSlotWithOptions(SlotId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSlotResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeSlot',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots/${OpenApiUtil.getEncodeParam(SlotId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSlot(SlotId: string): DescribeSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSlotWithOptions(SlotId, headers, runtime);
}

model ListComponentsRequest {
  componentIds?: string(name='ComponentIds', example='cmpt-my1tk3jggooi5uwks5,cmpt-n69468yvjz8d12as7d,cmpt-tga4omjrepklkg1onn'),
  name?: string(name='Name', example='dataset-accelerator'),
  order?: string(name='Order', example='Desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  version?: string(name='Version', example='v1.0.0'),
}

model ListComponentsResponseBody = {
  components?: [ 
    {
      gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
      name?: string(name='Name', example='dataset-accelerator'),
      ownerId?: string(name='OwnerId', example='1557702098194904'),
      template?: {
        type?: string(name='Type', example='OSS'),
        uri?: string(name='Uri', example='data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
      }(name='Template'),
      userId?: string(name='UserId', example='276065346797410278'),
      uuid?: string(name='Uuid', example='cmpt-5zk866779me51jgu3w'),
      version?: string(name='Version', example='v1.0.0'),
    }
  ](name='Components'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model ListComponentsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListComponentsResponseBody(name='body'),
}

async function listComponentsWithOptions(request: ListComponentsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListComponentsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.componentIds)) {
    query['ComponentIds'] = request.componentIds;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.version)) {
    query['Version'] = request.version;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListComponents',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/components`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listComponents(request: ListComponentsRequest): ListComponentsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listComponentsWithOptions(request, headers, runtime);
}

model ListEndpointsRequest {
  endpointIds?: string(name='EndpointIds', example='end-my1tk3jggooi5uwks5,end-n69468yvjz8d12as7d,end-tga4omjrepklkg1onn'),
  instanceIds?: string(name='InstanceIds', description='所属加速实例的ID。', example='inst-ivrq92qhbyrg4jctih'),
  name?: string(name='Name', example='acc_instance_slot_mount_1'),
  order?: string(name='Order', example='Desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  slotIds?: string(name='SlotIds', example='slot-my1tk3jggooi5uwks5'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  type?: string(name='Type', example='VPC'),
}

model ListEndpointsResponseBody = {
  endpoints?: [ 
    {
      gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
      instanceId?: string(name='InstanceId', description='所属加速实例的ID。', example='inst-ivrq92qhbyrg4jctih'),
      name?: string(name='Name', example='endpoint-1'),
      ownerId?: string(name='OwnerId', example='1557702098194904'),
      status?: EndpointStatus(name='Status'),
      type?: string(name='Type', example='VPC'),
      userId?: string(name='UserId', example='276065346797410278'),
      uuid?: string(name='Uuid', example='end-ivrq92qhbyrg4jctih'),
      vpcId?: string(name='VpcId', example='vpc-j6co2fcdsl1q0gnuc3ym3'),
      vswitchId?: string(name='VswitchId', example='vsw-j6cmr00qjyrft6jo2mg7g'),
    }
  ](name='Endpoints'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model ListEndpointsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListEndpointsResponseBody(name='body'),
}

async function listEndpointsWithOptions(request: ListEndpointsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListEndpointsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endpointIds)) {
    query['EndpointIds'] = request.endpointIds;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.slotIds)) {
    query['SlotIds'] = request.slotIds;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListEndpoints',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/endpoints`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listEndpoints(request: ListEndpointsRequest): ListEndpointsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listEndpointsWithOptions(request, headers, runtime);
}

model ListInstancesRequest {
  instanceIds?: string(name='InstanceIds', example='inst-my1tk3jggooi5uwks5, inst-n69468yvjz8d12as7d, inst-tga4omjrepklkg1onn'),
  name?: string(name='Name', example='acc_instance_1'),
  order?: string(name='Order', example='Desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  paymentType?: string(name='PaymentType', example='PayAsYouGo'),
  phase?: string(name='Phase', example='Running'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  type?: string(name='Type', example='basic'),
}

model ListInstancesResponseBody = {
  instances?: [ 
    {
      capacity?: string(name='Capacity', example='30.0G'),
      description?: string(name='Description', example='xgboost数据集加速实例'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
      ioType?: string(name='IoType', example='readonly'),
      maxEndpoint?: int32(name='MaxEndpoint', description='数据集加速实例的最大挂载点个数。'),
      maxSlot?: int32(name='MaxSlot', example='20'),
      name?: string(name='Name', example='acc_instance_1'),
      ownerId?: string(name='OwnerId', example='1557702098194904'),
      paymentType?: string(name='PaymentType', example='PayAsYouGo'),
      providerType?: string(name='ProviderType', description='数据集加速实例的资源提供者类型。', example='Ecs'),
      status?: InstanceStatus(name='Status'),
      storageType?: string(name='StorageType', description='数据集加速实例的存储类型。', example='OSS'),
      tags?: [ 
        {
          key?: string(name='Key', example='dataset_version'),
          value?: string(name='Value', example='v0.1.0'),
        }
      ](name='Tags'),
      type?: string(name='Type', example='Basic'),
      userId?: string(name='UserId', example='276065346797410278'),
      uuid?: string(name='Uuid', example='inst-my1tk3jggooi5uwks5'),
    }
  ](name='Instances'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model ListInstancesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListInstancesResponseBody(name='body'),
}

async function listInstancesWithOptions(request: ListInstancesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.paymentType)) {
    query['PaymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.phase)) {
    query['Phase'] = request.phase;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstancesWithOptions(request, headers, runtime);
}

model ListSlotsRequest {
  endpointIds?: string(name='EndpointIds', description='加速槽所对应的数据集加速挂载点的唯一标识符。', example='endp-my1tk3jggooi5uwks5'),
  instanceIds?: string(name='InstanceIds', example='inst-my1tk3jggooi5uwks5'),
  name?: string(name='Name', example='acc_instance_slot_1'),
  order?: string(name='Order', example='Desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  phase?: string(name='Phase', example='Running'),
  slotIds?: string(name='SlotIds', example='slot-my1tk3jggooi5uwks5,slot-n69468yvjz8d12as7d,slot-tga4omjrepklkg1onn'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  storageType?: string(name='StorageType', example='OSS'),
  storageUri?: string(name='StorageUri', description='数据集加速槽的数据存储路径（URI）。'),
}

model ListSlotsResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  slots?: [ 
    {
      capacity?: string(name='Capacity', example='30.0G'),
      description?: string(name='Description', example='xgboost数据集加速槽'),
      endpoints?: [ 
        {
          gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
          gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
          name?: string(name='Name', example='endpoint-1'),
          ownerId?: string(name='OwnerId', example='1557702098194904'),
          status?: EndpointStatus(name='Status'),
          type?: string(name='Type', example='VPC'),
          userId?: string(name='UserId', example='276065346797410278'),
          uuid?: string(name='Uuid', example='end-ivrq92qhbyrg4jctih'),
          vpcId?: string(name='VpcId', example='vpc-j6co2fcdsl1q0gnuc3ym3'),
          vswitchId?: string(name='VswitchId', example='vsw-j6cmr00qjyrft6jo2mg7g'),
        }
      ](name='Endpoints'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
      instanceId?: string(name='InstanceId', example='inst-my1tk3jggooi5uwks5'),
      ioType?: string(name='IoType', description='数据集加速槽的读写类型。', example='readonly'),
      lifeCycle?: SlotLifeCycle(name='LifeCycle'),
      name?: string(name='Name', example='slot_1'),
      ownerId?: string(name='OwnerId', example='1557702098194904'),
      status?: SlotStatus(name='Status'),
      storageType?: string(name='StorageType', example='OSS'),
      storageUri?: string(name='StorageUri', example='oss://pai-vision-data-hz2.oss-cn-hangzhou-internal.aliyuncs.com/data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
      tags?: [ 
        {
          key?: string(name='Key', example='dataset_version'),
          value?: string(name='Value', example='v0.1.0'),
        }
      ](name='Tags'),
      userId?: string(name='UserId', example='276065346797410278'),
      uuid?: string(name='Uuid', example='slot-5zk866779me51jgu3w'),
    }
  ](name='Slots'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model ListSlotsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSlotsResponseBody(name='body'),
}

async function listSlotsWithOptions(request: ListSlotsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSlotsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endpointIds)) {
    query['EndpointIds'] = request.endpointIds;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phase)) {
    query['Phase'] = request.phase;
  }
  if (!Util.isUnset(request.slotIds)) {
    query['SlotIds'] = request.slotIds;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.storageType)) {
    query['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.storageUri)) {
    query['StorageUri'] = request.storageUri;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSlots',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSlots(request: ListSlotsRequest): ListSlotsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSlotsWithOptions(request, headers, runtime);
}

model ListTagsRequest {
  key?: string(name='Key', example='dataset_version'),
  order?: string(name='Order', example='Desc'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  resourceId?: string(name='ResourceId', example='inst-my1tk3jggooi5uwks5'),
  resourceType?: string(name='ResourceType', example='instance'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  value?: string(name='Value', example='v0.1.0'),
}

model ListTagsResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  tags?: [ 
    {
      gmtCreateTime?: string(name='GmtCreateTime', example='2014-10-02T15:01:23Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2014-10-02T15:01:23Z'),
      key?: string(name='Key', example='dataset_version'),
      ownerId?: string(name='OwnerId', example='1557702098194904'),
      resourceId?: string(name='ResourceId', example='inst-my1tk3jggooi5uwks'),
      resourceType?: string(name='ResourceType', example='Instance'),
      userId?: string(name='UserId', example='276065346797410278'),
      value?: string(name='Value', example='v0.1.0'),
    }
  ](name='Tags'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model ListTagsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTagsResponseBody(name='body'),
}

async function listTagsWithOptions(request: ListTagsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTagsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.value)) {
    query['Value'] = request.value;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTags',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/tags`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTags(request: ListTagsRequest): ListTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTagsWithOptions(request, headers, runtime);
}

model QueryInstanceMetricsRequest {
  dimensions?: map[string]any(name='Dimensions', example='SlotIDs: xxx'),
  endTime?: string(name='EndTime', example='2020-11-08T16:00:00Z'),
  metricType?: string(name='MetricType', example='StorageUsage'),
  startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'),
  timeStep?: string(name='TimeStep', example='5m'),
}

model QueryInstanceMetricsShrinkRequest {
  dimensionsShrink?: string(name='Dimensions', example='SlotIDs: xxx'),
  endTime?: string(name='EndTime', example='2020-11-08T16:00:00Z'),
  metricType?: string(name='MetricType', example='StorageUsage'),
  startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'),
  timeStep?: string(name='TimeStep', example='5m'),
}

model QueryInstanceMetricsResponseBody = {
  metrics?: [
    Metric
  ](name='Metrics'),
  period?: string(name='Period', example='60s'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model QueryInstanceMetricsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryInstanceMetricsResponseBody(name='body'),
}

async function queryInstanceMetricsWithOptions(InstanceId: string, tmpReq: QueryInstanceMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryInstanceMetricsResponse {
  Util.validateModel(tmpReq);
  var request = new QueryInstanceMetricsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.dimensions)) {
    request.dimensionsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.dimensions, 'Dimensions', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.dimensionsShrink)) {
    query['Dimensions'] = request.dimensionsShrink;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.timeStep)) {
    query['TimeStep'] = request.timeStep;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryInstanceMetrics',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/instances/${OpenApiUtil.getEncodeParam(InstanceId)}/metrics/action/query`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryInstanceMetrics(InstanceId: string, request: QueryInstanceMetricsRequest): QueryInstanceMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryInstanceMetricsWithOptions(InstanceId, request, headers, runtime);
}

model QuerySlotMetricsRequest {
  dimensions?: map[string]any(name='Dimensions', example='SlotIDs: xxx'),
  endTime?: string(name='EndTime', example='2020-11-08T16:00:00Z'),
  metricType?: string(name='MetricType', example='NetworkReceiveBytesPerSecond'),
  startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'),
  timeStep?: string(name='TimeStep', example='5m'),
}

model QuerySlotMetricsShrinkRequest {
  dimensionsShrink?: string(name='Dimensions', example='SlotIDs: xxx'),
  endTime?: string(name='EndTime', example='2020-11-08T16:00:00Z'),
  metricType?: string(name='MetricType', example='NetworkReceiveBytesPerSecond'),
  startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'),
  timeStep?: string(name='TimeStep', example='5m'),
}

model QuerySlotMetricsResponseBody = {
  metrics?: [
    Metric
  ](name='Metrics'),
  period?: string(name='Period', example='60s'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model QuerySlotMetricsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySlotMetricsResponseBody(name='body'),
}

async function querySlotMetricsWithOptions(SlotId: string, tmpReq: QuerySlotMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySlotMetricsResponse {
  Util.validateModel(tmpReq);
  var request = new QuerySlotMetricsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.dimensions)) {
    request.dimensionsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.dimensions, 'Dimensions', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.dimensionsShrink)) {
    query['Dimensions'] = request.dimensionsShrink;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['MetricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.timeStep)) {
    query['TimeStep'] = request.timeStep;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySlotMetrics',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots/${OpenApiUtil.getEncodeParam(SlotId)}/metrics/action/query`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function querySlotMetrics(SlotId: string, request: QuerySlotMetricsRequest): QuerySlotMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySlotMetricsWithOptions(SlotId, request, headers, runtime);
}

model QueryStatisticRequest {
  endTime?: string(name='EndTime', example='2020-11-08T16:00:00Z'),
  fields?: string(name='Fields', example='InstanceCapacityEachType'),
  startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'),
}

model QueryStatisticResponseBody = {
  instanceCapacityEachType?: map[string]any(name='InstanceCapacityEachType'),
  instanceNumEachType?: map[string]any(name='InstanceNumEachType'),
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
  slotNumEachType?: map[string]any(name='SlotNumEachType'),
}

model QueryStatisticResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryStatisticResponseBody(name='body'),
}

async function queryStatisticWithOptions(request: QueryStatisticRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryStatisticResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.fields)) {
    query['Fields'] = request.fields;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryStatistic',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/statistics/action/query`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryStatistic(request: QueryStatisticRequest): QueryStatisticResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryStatisticWithOptions(request, headers, runtime);
}

model ReloadSlotResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model ReloadSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReloadSlotResponseBody(name='body'),
}

async function reloadSlotWithOptions(SlotId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ReloadSlotResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ReloadSlot',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots/${OpenApiUtil.getEncodeParam(SlotId)}/action/reload`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function reloadSlot(SlotId: string): ReloadSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return reloadSlotWithOptions(SlotId, headers, runtime);
}

model StopSlotResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model StopSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopSlotResponseBody(name='body'),
}

async function stopSlotWithOptions(SlotId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StopSlotResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StopSlot',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots/${OpenApiUtil.getEncodeParam(SlotId)}/action/stop`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopSlot(SlotId: string): StopSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopSlotWithOptions(SlotId, headers, runtime);
}

model UnbindEndpointResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model UnbindEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UnbindEndpointResponseBody(name='body'),
}

async function unbindEndpointWithOptions(EndpointId: string, SlotId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UnbindEndpointResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UnbindEndpoint',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/endpoints/${OpenApiUtil.getEncodeParam(EndpointId)}/slots/${OpenApiUtil.getEncodeParam(SlotId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function unbindEndpoint(EndpointId: string, SlotId: string): UnbindEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return unbindEndpointWithOptions(EndpointId, SlotId, headers, runtime);
}

model UpdateInstanceRequest {
  description?: string(name='Description', example='xgboost数据集加速实例'),
  maxSlot?: string(name='MaxSlot', example='20'),
  name?: string(name='Name', example='acc_instance_1'),
}

model UpdateInstanceResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model UpdateInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateInstanceResponseBody(name='body'),
}

async function updateInstanceWithOptions(InstanceId: string, request: UpdateInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.maxSlot)) {
    body['MaxSlot'] = request.maxSlot;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstance',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/instances/${OpenApiUtil.getEncodeParam(InstanceId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateInstance(InstanceId: string, request: UpdateInstanceRequest): UpdateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateInstanceWithOptions(InstanceId, request, headers, runtime);
}

model UpdateSlotRequest {
  capacity?: string(name='Capacity', example='30.0G'),
  description?: string(name='Description', example='xgboost数据集加速槽'),
  lifeCycle?: SlotLifeCycle(name='LifeCycle'),
  name?: string(name='Name', example='slot_1'),
  storageType?: string(name='StorageType', example='OSS'),
  storageUri?: string(name='StorageUri', example='oss://pai-vision-data-hz2.oss-cn-hangzhou-internal.aliyuncs.com/data/VOCdevkit/VOC2007/ImageSets/Main/val.txt'),
  tags?: [ 
    {
      key?: string(name='Key', example='dataset_version'),
      value?: string(name='Value', example='v0.1.0'),
    }
  ](name='Tags'),
}

model UpdateSlotResponseBody = {
  requestId?: string(name='RequestId', example='A731A84D-55C9-44F7-99BB-E1CF0CF19197'),
}

model UpdateSlotResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateSlotResponseBody(name='body'),
}

async function updateSlotWithOptions(SlotId: string, request: UpdateSlotRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateSlotResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.capacity)) {
    body['Capacity'] = request.capacity;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.lifeCycle)) {
    body['LifeCycle'] = request.lifeCycle;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.storageType)) {
    body['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.storageUri)) {
    body['StorageUri'] = request.storageUri;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateSlot',
    version = '2022-08-01',
    protocol = 'HTTPS',
    pathname = `/api/v1/slots/${OpenApiUtil.getEncodeParam(SlotId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateSlot(SlotId: string, request: UpdateSlotRequest): UpdateSlotResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateSlotWithOptions(SlotId, request, headers, runtime);
}

